package mylib.archive.y2012.m09.CF138;

import mylib.dir.FastInputReader;
import mylib.dir.InputUtils;
import mylib.dir.OutputUtils;

import java.io.PrintWriter;
import java.math.BigInteger;

public class TaskC {
    final int MOD = 1000000000 + 7;

    public void solve(int testNumber, FastInputReader in, PrintWriter out) {
        int n = in.nextInt();
        int k = in.nextInt();
        int[] r = new int[n];
        InputUtils.inputArray(in, r);
        int[] v = build(n, k);
        int[][] mat = build(v);
        int[] res = mul(r, mat);
        OutputUtils.outArray(out, res);

//        int[][]a=new int[n][n];
//        for (int i = 0; i < n; ++i) {
//            for (int j = 0; j <= i; ++j)
//                a[i][j] = 1;
//        }
//
//        int[][]b=clone(a);
//        for (int it = 0; it < 100; ++it) {
//            out.println("iter = " + (it + 1));
//            a = MatrixUtils.mul(a, b, 1000000000 + 7);
//            for (int i = 0; i < n; ++i) {
//                for (int j = 0; j < n; ++j)
//                    out.print(a[i][j]  + " ");
//                out.println();
//            }
//            int[][]mat1 = build(build(n, it + 2));
//            out.println();
//            for (int i = 0; i < mat.length; ++i) {
//                out.println(Arrays.toString(mat1[i]));
//            }
//            out.println("---------------------------------------");
//        }
    }

    private int[][] build(int[] v) {
        int n = v.length;
        int[][] mat = new int[n][n];
        for (int i = 0; i < n; ++i) {
            for (int j = i; j < n; ++j) {
                mat[j][i] = v[j - i];
            }
        }
        return mat;
    }

    private int[] mul(int[] r, int[][] mat) {
        int[] ans = new int[r.length];
        for (int i = 0; i < ans.length; ++i) {
            long res = 0;
            for (int j = 0; j < ans.length; ++j) {
                res = (res + (long) mat[i][j] * r[j] % MOD) % MOD;
            }
            ans[i] = (int) res;
        }
        return ans;
    }

    private int[] build(int n, int k) {
        int[] a = new int[n];
        BigInteger cur = BigInteger.valueOf(1);
        for (int i = 0; i < n; ++i) {
            if (i == 0) {
                a[i] = cur.intValue();
            } else {
                BigInteger tmp = cnk(k - 1 + i, k - 1, cur);
                a[i] = tmp.mod(BigInteger.valueOf(MOD)).intValue();
                cur = tmp;
            }
        }
        return a;
    }

    private BigInteger cnk(int n, int k, BigInteger prev) {
        BigInteger now = prev.multiply(BigInteger.valueOf(n));
        now = now.divide(BigInteger.valueOf(n - k));

        return now;
    }

    private int[][] clone(int[][] a) {
        int[][] b = new int[a.length][a[0].length];
        for (int i = 0; i < a.length; ++i)
            b[i] = a[i].clone();
        return b;
    }
}
